<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>查看用户借书信息</title>

    <!--表格-->
    <style>
        .el-table .warning-row {
            background: oldlace;
        }

        .el-table .success-row {
            background: #f0f9eb;
        }

        .el-header {
            background-color: #B3C0D1;
            color: #333;
            text-align: center;
            line-height: 60px;
            font-size: 30px;
        }

        .el-footer{
            background-color: #B3C0D1;
            color: #333;
            text-align: center;
            line-height: 60px;

        }

        .el-main {
            background-color: #E9EEF3;
            color: #333;
            text-align: left;
            line-height: 40px;
        }

    </style>
</head>
<body>
<div id="app">

    <el-container>
        <el-header>用户的借书信息</el-header>
        <el-main>

            <!--表格-->
            <template>
                <el-table
                        :data="tableData"
                        height="500"
                        border
                        style="width: 100%">
                    <el-table-column
                            type="index"
                            align="center">
                    </el-table-column>
                    <el-table-column
                            prop="time"
                            label="还书日期"
                            align="center">
                    </el-table-column>
                    <el-table-column
                            prop="name"
                            label="书籍名称"
                            align="center">
                    </el-table-column>
                    <el-table-column
                            prop="username"
                            label="借书人"
                            align="center">
                    </el-table-column>
                    <el-table-column
                            prop="overtime"
                            label="是否逾期"
                            align="center">
                    </el-table-column>
                </el-table>
            </template>

        </el-main>

        <el-footer>图书管理系统</el-footer>
    </el-container>




</div>

<script src="js/vue.js"></script>
<script src="element-ui/lib/index.js"></script>
<link rel="stylesheet" href="element-ui/lib/theme-chalk/index.css">
<script src="js/axios-0.18.0.js"></script>

<script>
    new Vue({
        el: "#app",

        mounted() {
            this.selectAll();

        },

        methods: {

            selectAll() {

                var _this = this;

                axios({
                    method: "get",
                    url: "http://localhost:8080/bookstore/book/selectBorrow",
                }).then(function (resp) {
                    _this.tableData = resp.data;
                })
            },

            tableRowClassName({row, rowIndex}) {
                if (rowIndex === 1) {
                    return 'warning-row';
                } else if (rowIndex === 3) {
                    return 'success-row';
                }
                return '';
            },


            sleep(d){
                return new Promise((resolve => setTimeout(resolve,d)))
            },


        },

        data() {
            return {
                //书籍的数据
                borrow: {
                    name: '',
                    username:'',
                    time: '',
                    overtime:'',
                    category:''
                },

                //表格数据
                tableData: [{
                    time: '2022-5-10',
                    name: '西游记',
                    username: '王小虎',
                    overtime: '是'
                }, {
                    time: '2022-5-10',
                    name: '西游记',
                    username: '王小虎',
                    overtime: '是'
                }, {
                    time: '2022-5-10',
                    name: '西游记',
                    username: '王小虎',
                    overtime: '是'
                }, {
                    time: '2022-5-10',
                    name: '西游记',
                    username: '王小虎',
                    overtime: '是'
                }, {
                    time: '2022-5-10',
                    name: '西游记',
                    username: '王小虎',
                    overtime: '是'
                }, {
                    time: '2022-5-10',
                    name: '西游记',
                    username: '王小虎',
                    overtime: '是'
                }, {
                    time: '2022-5-10',
                    name: '西游记',
                    username: '王小虎',
                    overtime: '是'
                }]
            }
        }
    })


</script>
</body>
</html>